home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr48 / desksamp.zip / DESKTOP.PAS < prev   
Pascal/Delphi Source File  |  1993-04-05  |  15KB  |  576 lines

  1. Program KevinDesktop(Input,output);
  2.  
  3. uses Crt,Dos;
  4.  
  5. const
  6. days : array [0..6] of String[9] =
  7.   ('Sunday','Monday','Tuesday',
  8.    'Wednesday','Thursday','Friday',
  9.    'Saturday');
  10.  
  11. var
  12.   year,month,day,dayofweek,hour,minute,second,splitsecond: Word; {Time Tracker}
  13.   option: char; {selection of what application}
  14.   quit: boolean;  {allows quiting}
  15.   Schedule: Array[1..17] of String; {schedule array}
  16.   Data:Array[1..50,1..4] of String; {database array}
  17.   Curpointer: integer;              {cursor pointer}
  18.   curoption: string; {string containing current option}
  19.  
  20. Procedure disptitle; {procedure for title window}
  21.   begin
  22.       gotoxy(1,1);
  23.       write('╔═══════Title════════════╗');
  24.       gotoxy(1,2);
  25.       write('║Automagic DESKTOP SYTEMS║');
  26.       gotoxy(1,3);
  27.       write('║To complete all computer║');
  28.       gotoxy(1,4);
  29.       write('║         needs          ║');  {puts title on screen}
  30.       gotoxy(1,5);
  31.       write('║     by Kevin Hellman   ║');
  32.       gotoxy(1,6);
  33.       write('║   (C)opyright VGA tm   ║');
  34.       gotoxy(1,7);
  35.       write('╚════════════════════════╝');
  36.    end; {disptitle}
  37.  
  38. Procedure dispstatbox; {this procedure makes the statbox}
  39. begin
  40.       gotoxy(27,1);
  41.       write('╔══════════════════Stat═Box═════════════════════════╗');
  42.       gotoxy(27,2);
  43.       write('║',diskfree(3),' bytes free on drive c:');  {display bytes free}
  44.       gotoxy(79,2);
  45.       write('║');
  46.       getdate(year,month,day,dayofweek);
  47.       gotoxy(27,3);
  48.       write('║ Date:', days[dayofweek],', ',month:0, '/', day:0, '/', year:0);
  49.       gotoxy(79,3);
  50.       write('║');
  51.       gotoxy(27,4);
  52.       gettime(hour,minute,second,splitsecond);
  53.       write('║ Time:',hour,':',minute,':',second);
  54.       gotoxy(79,4);
  55.       write('║');
  56.       gotoxy(27,5);
  57.       write('╠═════════════Current═Application═══════════════════╣');
  58.       gotoxy(27,6);
  59.       write('║          ',curoption);
  60.       gotoxy(79,6);
  61.       write('║');
  62.       gotoxy(27,7);
  63.       write('╚═══════════════════════════════════════════════════╝');
  64.     end; {dispstatbox}
  65.  
  66. Procedure initialize; {this is the intro screen}
  67. begin
  68.       curoption:='none';
  69.       curpointer:=0;
  70.       quit:=false;
  71.       clrscr;
  72.       disptitle;
  73.       dispstatbox;
  74.       delay(5000);
  75.       clrscr;
  76. end; {disp intialize}
  77.  
  78. procedure MainMenu;  {the main menu}
  79.     begin
  80.       gotoxy(1,1);
  81.       write('╔═══════Menu═════════════╗');
  82.       gotoxy(1,2);
  83.       write('║1__Shell/File Runner    ║');
  84.       gotoxy(1,3);
  85.       write('║2__Schedule             ║');
  86.       gotoxy(1,4);
  87.       write('║3__Data Base            ║');  {puts title on screen}
  88.       gotoxy(1,5);
  89.       write('║4__Word proccesor       ║');
  90.       gotoxy(1,6);
  91.       write('║  ENTER OPTION NUMBER   ║');
  92.       gotoxy(1,7);
  93.       write('╚════════════════════════╝');
  94.       option:='0';
  95.       while (option<'1') or (option>'4') do
  96.         begin
  97.           sound(100);
  98.           delay(100);
  99.           nosound;
  100.           gotoxy(1,8);
  101.           readln(option);
  102.           gotoxy(1,8);
  103.           writeln;
  104.         end;
  105.    end; {main menu}
  106.  
  107. Procedure FileRunnermenu;   {the file runner menu}
  108.   begin
  109.     gotoxy(1,1);
  110.       write('╔═══════Menu═════════════╗');
  111.       gotoxy(1,2);
  112.       write('║1__Run A Program        ║');
  113.       gotoxy(1,3);
  114.       write('║2__Display a file       ║');
  115.       gotoxy(1,4);
  116.       write('║3__Change Path          ║');  
  117.       gotoxy(1,5);
  118.       write('║                        ║');
  119.       gotoxy(1,6);
  120.       write('║4__Return to main       ║');
  121.       gotoxy(1,7);
  122.       write('╚════════════════════════╝');
  123.       option:='0';
  124.       while (option<'1') or (option>'4') do
  125.         begin
  126.           sound(100);
  127.           delay(100);
  128.           nosound;
  129.           gotoxy(1,8);
  130.           readln(option);
  131.         end;
  132.     end;  {file runner menu}
  133.  
  134. Procedure FileSheller;  {shells out to programs}
  135.   var
  136.      ProgramName, CmdLine: string;
  137.      f : text;
  138. begin
  139.   gotoxy(1,8);
  140.   Write('File to Run:');
  141.   readln(ProgramName);
  142.   gotoxy(1,8);
  143.   writeln;
  144.   Assign(f, 'temp.bat');
  145.   Rewrite(f);
  146.   Write(f,programname); { Dump text file }
  147.   close(f);
  148.   quit:=true;
  149. end; {file sheller}
  150.  
  151. Procedure DisplayFile;  {display a text file}
  152.  var
  153.  S: PathStr;
  154.  F:text;
  155.  temp:string;
  156.  Name: string;
  157.  linenumber: integer;
  158.    begin
  159.      gotoxy(1,8);
  160.      write('File to open:');
  161.      readln(Name);
  162.      gotoxy(1,8);
  163.      writeln;
  164.      S := FSearch(Name,GetEnv('PATH'));
  165.        if S = '' then
  166.           begin
  167.           gotoxy(1,8);
  168.           WriteLn('File not found');
  169.           exit;
  170.           end;
  171.           clrscr;
  172.           { Get file to read from command line }
  173.           Assign(f, Name);
  174.           Reset(f);
  175.           linenumber:=0;
  176.           while not Eof(f) do
  177.             begin
  178.                  Readln(f,temp);
  179.                  Writeln(temp); { Dump text file }
  180.                  linenumber:=linenumber+1;
  181.                  if linenumber/20=int(linenumber/20)then readln(temp);
  182.              end;
  183.           readln(temp);
  184. end;  {displaymenu}
  185.  
  186. Procedure Changedir;   {change directory}
  187.   var
  188.     temp: string;
  189.   begin
  190.     gotoxy(1,8);
  191.     write('Dir:');
  192.     readln(temp);
  193.     gotoxy(1,8);
  194.     writeln;
  195.     chdir(temp);
  196.   end;  {chdir}
  197.  
  198. Procedure FileRunner;  {main file runner procedure}
  199.   var
  200.     DirInfo: SearchRec; {dir holder}
  201.     curpos:integer;     {current position}
  202.     securpos:integer;   {second currentpos}
  203.   begin
  204.     curoption:='filerunner';
  205.     dispstatbox;
  206.     gotoxy(1,9);
  207.     Writeln('╔Current═Directory═════════════════════════════════════════════════════════════');
  208.     FindFirst('*.*', Archive, DirInfo);
  209.     curpos:=1;
  210.     securpos:=1;
  211.       while DosError = 0 do
  212.          begin
  213.           gotoxy(securpos,curpos+9);
  214.           Write('║',dirInfo.Name);
  215.           FindNext(DirInfo);
  216.           curpos:=curpos+1;
  217.           if curpos=15 then
  218.            begin
  219.              curpos:=0;
  220.              securpos:=securpos+15;
  221.            end;
  222.         end;
  223.      repeat
  224.            FileRunnerMenu;
  225.            dispstatbox;
  226.            if option='1' then FileSheller;
  227.            if option='2' then DisplayFile;
  228.            if option='3' then Changedir;
  229.     until option='4';
  230.     option:='0';
  231.   end;  {file runner}
  232.  
  233. procedure DispScheduleMenu;
  234.    begin
  235.       gotoxy(1,1);
  236.       write('╔═══════Menu═════════════╗');
  237.       gotoxy(1,2);
  238.       write('║1__Load Schedule        ║');
  239.       gotoxy(1,3);
  240.       write('║2__Display Schedule     ║');
  241.       gotoxy(1,4);
  242.       write('║3__Save Schedule        ║');
  243.       gotoxy(1,5);
  244.       write('║4__Edit Schedule        ║');
  245.       gotoxy(1,6);
  246.       write('║5__Return to main       ║');
  247.       gotoxy(1,7);
  248.       write('╚════════════════════════╝');
  249.       option:='0';
  250.       while (option<'1') or (option>'5') do
  251.         begin
  252.           sound(100);
  253.           delay(100);
  254.           nosound;
  255.           gotoxy(1,8);
  256.           readln(option);
  257.           gotoxy(1,8);
  258.           writeln;
  259.         end;
  260. end; {displayschedule}
  261.  
  262. Procedure LoadSchedule;
  263.   var
  264.     fname :string;
  265.     F:text;
  266.     counter:integer;
  267.     DirInfo: SearchRec;
  268.     curpos:integer;
  269.     securpos:integer;
  270.   begin
  271.     gotoxy(1,9);
  272.     Writeln('╔Current═Directory═════════════════════════════════════════════════════════════');
  273.     FindFirst('*.SCD', Archive, DirInfo);
  274.     curpos:=1;
  275.     securpos:=1;
  276.       while DosError = 0 do
  277.          begin
  278.           gotoxy(securpos,curpos+9);
  279.           Write('║',dirInfo.Name);
  280.           FindNext(DirInfo);
  281.           curpos:=curpos+1;
  282.           if curpos=15 then
  283.            begin
  284.              curpos:=0;
  285.              securpos:=securpos+15;
  286.            end;
  287.         end;
  288.     gotoxy(1,8);
  289.     Write('File to open:');
  290.     readln(Fname);
  291.     gotoxy(1,8);
  292.     writeln;
  293.     assign(f,fname);
  294.     reset(f);
  295.     for Counter:=1 to 17  do
  296.       readln(f,schedule[Counter]);
  297.     close(f);
  298. end; {loadschedule}
  299.  
  300. Procedure EditSchedule;
  301. var
  302.  counter:integer;
  303.  clock:integer;
  304.  begin
  305.  clrscr;
  306.   writeln('                          ╔══════Schedule═══════════╗');
  307.  For counter:=1 to 17 do
  308.    begin
  309.      clock:=counter+5;
  310.      if clock>12 then clock:=clock-12;
  311.      write('                          ║ ',clock,':00 ');
  312.      readln(schedule[counter]);
  313.    end;
  314.      writeln('                          ╚═════════════════════════╝');
  315.  end; {edit schedule}
  316.  
  317. Procedure DispSchedule;
  318.   var
  319.    counter:integer;
  320.    clock:integer;
  321.   begin
  322.    clrscr;
  323.    writeln('                          ╔══════Schedule═══════════╗');
  324.  For counter:=1 to 17 do
  325.    begin
  326.      clock:=counter+5;
  327.      if clock>12 then clock:=clock-12;
  328.      writeln('                          ║ ',clock,':00 ',schedule[counter]);
  329.     end;
  330.    writeln('                          ╚═════════════════════════╝');
  331.  end;  {dispschedule}
  332.  
  333. Procedure SaveSchedule;
  334.   var
  335.     fname :string;
  336.     F:text;
  337.     counter:integer;
  338.     DirInfo: SearchRec;
  339.     curpos:integer;
  340.     securpos:integer;
  341.   begin
  342.     gotoxy(1,9);
  343.     Writeln('╔Current═Directory═════════════════════════════════════════════════════════════');
  344.     FindFirst('*.SCD', Archive, DirInfo);
  345.     curpos:=1;
  346.     securpos:=1;
  347.       while DosError = 0 do
  348.          begin
  349.           gotoxy(securpos,curpos+9);
  350.           Write('║',dirInfo.Name);
  351.           FindNext(DirInfo);
  352.           curpos:=curpos+1;
  353.           if curpos=15 then
  354.            begin
  355.              curpos:=0;
  356.              securpos:=securpos+15;
  357.            end;
  358.         end;
  359.     gotoxy(1,8);
  360.     Write('File to Save:');
  361.     read(Fname);
  362.     gotoxy(1,8);
  363.     writeln;
  364.     assign(f,fname);
  365.     rewrite(f);
  366.     for Counter:=1 to 17  do
  367.       writeln(f,schedule[Counter]);
  368.     close(f);
  369. end;  {save schedule}
  370.  
  371. Procedure Scheduler;
  372.   begin
  373.     curoption:='Scheduler';
  374.     dispstatbox;
  375.     repeat
  376.          Dispschedulemenu;
  377.          dispstatbox;
  378.          if option='1' then LoadSchedule;
  379.          if option='4' then EditSchedule;
  380.          if option='2' then DispSchedule;
  381.          if option='3' then SaveSchedule;
  382.          until option='5';
  383.       option:='0';
  384.    end; {schedular}
  385.  
  386. Procedure Databasemenu;
  387.   begin
  388.       gotoxy(1,1);
  389.       write('╔═══════Menu═════════════╗');
  390.       gotoxy(1,2);
  391.       write('║1__Load Database        ║');
  392.       gotoxy(1,3);
  393.       write('║2__Display Database     ║');
  394.       gotoxy(1,4);
  395.       write('║3__Save Database        ║');
  396.       gotoxy(1,5);
  397.       write('║4__Add Record           ║');
  398.       gotoxy(1,6);
  399.       write('║5__Return to main       ║');
  400.       gotoxy(1,7);
  401.       write('╚════════════════════════╝');
  402.       option:='0';
  403.       while (option<'1') or (option>'5') do
  404.         begin
  405.           sound(100);
  406.           delay(100);
  407.           nosound;
  408.           gotoxy(1,8);
  409.           readln(option);
  410.           gotoxy(1,8);
  411.           writeln;
  412.         end;
  413. end;  {database menu}
  414.  
  415. Procedure LoadBase;  {load datebase}
  416.      var
  417.     fname :string;
  418.     F:text;
  419.     counter:integer;
  420.     DirInfo: SearchRec;
  421.     curpos:integer;
  422.     securpos:integer;
  423.     cp: string;
  424.   begin
  425.     gotoxy(1,9);
  426.     Writeln('╔Current═Directory═════════════════════════════════════════════════════════════');
  427.     FindFirst('*.DBS', Archive, DirInfo);
  428.     curpos:=1;
  429.     securpos:=1;
  430.       while DosError = 0 do
  431.          begin
  432.           gotoxy(securpos,curpos+9);
  433.           Write('║',dirInfo.Name);
  434.           FindNext(DirInfo);
  435.           curpos:=curpos+1;
  436.           if curpos=15 then
  437.            begin
  438.              curpos:=0;
  439.              securpos:=securpos+15;
  440.            end;
  441.         end;
  442.     gotoxy(1,8);
  443.     Write('File to open:');
  444.     read(Fname);
  445.     gotoxy(1,8);
  446.     writeln;
  447.     assign(f,fname);
  448.     reset(f);
  449.     while not eof(f) do
  450.       begin
  451.         readln(f,data[Counter,1],data[counter,2],data[counter,3],data[counter,4]);
  452.         curpointer:=curpointer+1;
  453.       end;
  454.     close(f);
  455. end;  {loadbase}
  456.  
  457. Procedure Dispbase;  {display base}
  458. var
  459. counter:integer;
  460. begin
  461.   Clrscr;
  462.   writeln('╔════════════════════════════════════════════════════════════════╗');
  463.   for counter:=1 to curpointer do
  464.   writeln('║',data[counter,1],' ',data[counter,2],' ',data[counter,3],' ',data[counter,4]);
  465.   writeln('╚════════════════════════════════════════════════════════════════╝');
  466.   readln;
  467. end;
  468.  
  469.  
  470. Procedure SaveBase; {display save base}
  471.      var
  472.     fname :string;
  473.     F:text;
  474.     counter:integer;
  475.     DirInfo: SearchRec;
  476.     curpos:integer;
  477.     securpos:integer;
  478.   begin
  479.     gotoxy(1,9);
  480.     Writeln('╔Current═Directory═════════════════════════════════════════════════════════════');
  481.     FindFirst('*.DBS', Archive, DirInfo);
  482.     curpos:=1;
  483.     securpos:=1;
  484.       while DosError = 0 do
  485.          begin
  486.           gotoxy(securpos,curpos+9);
  487.           Write('║',dirInfo.Name);
  488.           FindNext(DirInfo);
  489.           curpos:=curpos+1;
  490.           if curpos=15 then
  491.            begin
  492.              curpos:=0;
  493.              securpos:=securpos+15;
  494.            end;
  495.         end;
  496.     gotoxy(1,8);
  497.     Write('File to save:');
  498.     read(Fname);
  499.     gotoxy(1,8);
  500.     writeln;
  501.     assign(f,fname);
  502.     rewrite(f);
  503.     for Counter:=1 to curpointer do
  504.       writeln(f,data[Counter,1],data[counter,2],data[counter,3],data[counter,4]);
  505.     close(f);
  506. end;  {save data base}
  507.  
  508. Procedure Addbase;  {add to base}
  509.    Begin
  510.      clrscr;
  511.      curpointer:=curpointer+1;
  512.      gotoxy(27,1);
  513.      writeln('╔═════════════════════════════════════════╗');
  514.      gotoxy(27,2);
  515.      write('║ Record 1:');
  516.      readln(data[curpointer,1]);
  517.      gotoxy(27,3);
  518.      write('║ Record 2:');
  519.      readln(data[curpointer,2]);
  520.      gotoxy(27,4);
  521.      write('║ Record 3:');
  522.      readln(data[curpointer,3]);
  523.      gotoxy(27,5);
  524.      write('║ Record 4:');
  525.      readln(data[curpointer,4]);
  526.      gotoxy(27,6);
  527.      writeln('╚═════════════════════════════════════════╝');
  528.    end;  {addbase}
  529.  
  530. Procedure Database; {main database}
  531.   begin
  532.    clrscr;
  533.    curoption:='Database';
  534.    dispstatbox;
  535.       repeat
  536.      dispstatbox;
  537.      Databasemenu;
  538.      if option='1' then loadbase;
  539.      if option='2' then dispbase;
  540.      if option='3' then savebase;
  541.      if option='4' then addbase;
  542.    until option='5';
  543.      option:='0';
  544.   end;  {database}
  545.  
  546. Procedure Wordproccessor;  {a wordproccessor}
  547.      var
  548.      ProgramName, CmdLine: string;
  549.      f : text;
  550. begin
  551.   gotoxy(1,8);
  552.   Write('File to Proccess:');
  553.   readln(ProgramName);
  554.   gotoxy(1,8);
  555.   writeln;
  556.   Assign(f, 'temp.bat');
  557.   Rewrite(f);
  558.   Write(f,'ne '+programname); { Dump text file }
  559.   close(f);
  560.   quit:=true;
  561. end; {wordproccessor}
  562.  
  563. Begin {main part}
  564.    initialize;
  565.    while quit=false do
  566.      begin
  567.         clrscr;
  568.         dispstatbox;
  569.         MainMenu;
  570.         if option='1' then FileRunner;
  571.         if option='2' then Scheduler;
  572.         if option='3' then Database;
  573.         if option='4' then Wordproccessor;
  574.         curoption:='none';
  575.      end;
  576. end. {main part}